package com.xdy.mdc.activity;

import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.xdy.mdc.databinding.ActivityBottomSheetBinding;
import com.xdy.mdc.fragment.ModalBottomSheetFragment;

public class BottomSheetActivity extends BaseViewModelActivity<ActivityBottomSheetBinding> {

    @Override
    protected void initViews() {
        super.initViews();
        Window window = getWindow();
        WindowManager.LayoutParams attributes = window.getAttributes();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
            attributes.layoutInDisplayCutoutMode  = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
            window.setAttributes(attributes);
        }
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }

    @Override
    protected void initListeners() {
        super.initListeners();
        binding.btn.setOnClickListener(v -> {
            ModalBottomSheetFragment modalBottomSheetFragment = new ModalBottomSheetFragment();
            modalBottomSheetFragment.show(getSupportFragmentManager(),"ModalBottomSheetFragment");
        });
    }
}